home *** CD-ROM | disk | FTP | other *** search
- /*
- ** Undo.ced
- **
- ** $VER: Undo.ced 1.1 (1.2.95)
- **
- ** This script undoes the result of last CEd script execution or just last
- ** change if no script has been run.
- ** For more info see docs.
- **
- ** Copyright © 1995 Michael Letowski
- */
-
- /* Get host */
- PARSE SOURCE com res called resolved ext host .
- IF host="REXX" THEN /* From command line */
- ADDRESS "rexx_ced" /* Talk to default ced */
-
- OPTIONS RESULTS /* Enable results */
-
- ClipName=UndoClipName() /* Get clip name for current file */
-
- Res=GetClip(ClipName) /* Get number of undoes */
- IF Res='' THEN /* Clip not set */
- DO
- CALL Undo() /* Just Undo */
- EXIT
- END
- IF Res<=0 THEN /* Already undone */
- CALL Err()
-
- 'DM "Undoing..."' /* Change status bar */
-
- CALL SetClip(ClipName,-Res) /* Mark 'undone' status */
- DO FOR Res
- CALL Undo() /* Undo one change */
- END
-
- 'DM' /* Restore status line */
- EXIT
-
- UndoClipName:
- 'Status FILEMEM' /* Get address of current file */
- RETURN "CEDUndo."Right(D2X(RESULT),8,"0") /* Prepare unique name */
-
- Undo:
- 'Undo' /* Do operation */
- IF ~RESULT THEN /* Undo failed */
- CALL Err() /* Inform user */
- RETURN
-
- Err:
- 'DM' /* Restore status bar */
- 'Okay1' "Nothing more to undo."
- EXIT
-